<?php 
//   include phpreports library
require_once("./include/reportlib.php");
$betweenDate="";
if ($_POST['start_date'] != "" && $_POST['end_date'] != "") {
    $betweenDate = " AND p.ac_date between '" . $_POST['start_date'] . "' AND '" . $_POST['end_date'] . "' ";

    $sSQL = "SELECT ROUND(SUM(p.ac_paidWithDiscount),3) as total, paty.pt_description as description
            FROM " . TB_PREFIX . "payment p, " . TB_PREFIX . "payment_types paty
            WHERE p.ac_payment_type=paty.pt_id " . $betweenDate .
            " GROUP BY paty.pt_description";

    $oRpt->setXML("./modules/reports/report_sales_paid_total.xml");

//   include phpreports run code
    include("./include/reportrunlib.php");

    $smarty->assign('pageActive', 'report_sale');
    $smarty->assign('active_tab', '#money');
    $smarty->assign('start_date', $_POST['start_date']);
    $smarty->assign('end_date', $_POST['end_date']);
}
?>
